// {{ .Data.GenerateTitle }}
package datasource

import (
	"gitee.com/kristas/booting-go/framework"
	"gitee.com/kristas/booting-go/framework/core/statement/types"
	"gitee.com/kristas/booting-go/framework/data/datasource"
	"gorm.io/gorm"
)

func init() {
	framework.Component(new(GormDB))
}

type GormDB struct {
	types.ApplicationRunner `order:"1"`
	DS                      datasource.DataSource `wire:"application.datasource"`
	DB                      *gorm.DB
}

func (d *GormDB) AfterInit() {
	d.DB = d.DS.DB().(*gorm.DB)
}
